
public class ModelFrameMain extends AbstractModel {
	
	public static final Integer PANEL_ID_MENU = 0;
	public static final Integer PANEL_ID_MAPSELECTOR = 1;
	public static final Integer PANEL_ID_GAME = 2;
	
	private Integer panelID;
	private ModelPanelMenu mPanelMenu;
	private ModelPanelMapSelector mPanelMapSelector;
	private ModelPanelGame mPanelGame;
	
	/*
	 * Constructor
	 */
	public ModelFrameMain() {
		// Do nothing
	}
	
	/*
	 * Mutators
	 */	
	public void setModelPanelMenu(ModelPanelMenu mPM) {
		mPanelMenu = mPM;
	}
	
	public void setModelPanelGame(ModelPanelGame mPG) {
		mPanelGame = mPG;
	}
	
	public void setModelPanelMapSelector(ModelPanelMapSelector mPMS) {
		mPanelMapSelector = mPMS;
	}
	
	public void setPanelID(Integer pId) {
		System.out.println(this.getClass().toString() + ".setPanelID() called");
		Integer oldPanelID;
		if(panelID == null)
			oldPanelID = -1;
		else
			oldPanelID = panelID;
		panelID = pId;
		panelSwitchHandler(oldPanelID, panelID);
		firePropertyChange("panelID", oldPanelID, panelID);
	}
	
	/*
	 * Accessors
	 */
	public Integer getPanelID() {
		return panelID;
	}
	
	/*
	 * This method is called whenever a switch between different panels happens.
	 * (Still need to be modified)
	 */
	private void panelSwitchHandler(Integer previousPanelID, Integer nextPanelID) {
		if(previousPanelID == PANEL_ID_MAPSELECTOR && nextPanelID == PANEL_ID_GAME) {
			mPanelGame.setMap(WorldWar.mapLoader.getMapsList().get(mPanelMapSelector.getSelectedMapIndex()));
			mPanelGame.setRound(new Integer(0));
		}
	}
}
